/* $Header: p_alloc.c,v 2.2 01/10/02 10:27:45 przybyls Exp $ */

/***********************************************************************/
/*                                                                     */
/*                  Copyright Hewlett-Packard Co. 1991                 */
/*                                                                     */
/***********************************************************************/

/***********************************************************************/
/* MODULE NAME:                                                        */
/* ============                                                        */
/*                                                                     */
/* Author:                                                             */
/*                                                                     */
/* MODULE PURPOSE:                                                     */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/


/*****************************/
/*   GLOBAL INCLUDE FILES    */
/*****************************/

#include  <typedefs.h>
#include  <p_wkfile.h>
#include  <p_status.h>
#include  <pcb_defs.h>


/*****************************/
/*   LOCAL INCLUDE FILES     */
/*****************************/

/*****************************/
/*   GLOBAL VARIABLES        */
/*****************************/

/**begin_proto**/

#ifndef PNEU_KEY_OBJECTS
#define PNEU_KEY_OBJECTS

typedef enum { Wizard, Prove, Blessed, Moron, Idiot, Gone,
 /* oven  */  Icap,
 /* f inl */  F_Inlet, FI_PS, FI_FS, FI_Flow,FI_Calib,
 /* b inl */  B_Inlet, BI_PS, BI_FS, BI_Flow,BI_Calib,
 /* col 1 */  Column1, C1_Setpt, C1_Actual,
 /* col 2 */  Column2, C2_Setpt, C2_Actual,
 /* f det */  F_Det,   FD_G1, FD_G1_V, FD_G2, FD_G2_V, FD_G3, FD_G3_V, FD_Calib,
 /* b det */  B_Det,   BD_G1, BD_G1_V, BD_G2, BD_G2_V, BD_G3, BD_G3_V, BD_Calib,
 /* aux   */  Aux3, Aux4, Aux5, Aux3_V, Aux4_V, Aux5_V,PA_Calib,
 /* sig 1 */  /* jump to det diagnostics */
 /* sig 2 */  Environment,
 /* cc 1  */  TComp,
 /* cc 2  */  PComp,

 /* temp  */  Temp, Temp2,
 /* pres  */  Pres,
 /* flow  */  Stable_Volts,
 /* d ctrl*/  Env, Test_Status, Test_Regs,
 /* ramp  */  Max_Min, Env_Max_Min, RMS_Ctrl,

 /* status*/  Sig_Status, Pneu_Status,
 /* mode  */  Aux3_Ready, Aux4_Ready, Aux5_Ready,
 /* info  */  Pcb_Buffer, Sent, Recvd,
 /* clear */  Step,
 /* time  */  Masks, Halts,
 /* post  */  ReCalib,
 /* runlog*/  FI_P_Ready, FI_F_Ready, BI_P_Ready, BI_F_Ready,
 /* front */  FD_1F_Ready, FD_1P_Ready, FD_2F_Ready, FD_2P_Ready, FD_3F_Ready, FD_3P_Ready,
 /* option*/  /* step again */
 /* back  */  BD_1F_Ready, BD_1P_Ready, BD_2F_Ready, BD_2P_Ready, BD_3F_Ready, BD_3P_Ready,
 /* config*/  Pcb,
 /* delete*/  Confirm, EEprom, Erasing, Error_Calibrated,

 /* load  */  Load,
 /* method*/  Meth_Errors,
 /* t tbl */  FI_Hdr, FI_Therm, FI_PS_Terms, FI_FS_Parms, FI_SPR,
 /* f inj */  FD_Hdr, FD_Therm, FD_PS_1, FD_PS_2, FD_PS_3, FD_Frit_1, FD_Frit_2, FD_Frit_3,
 /* valve */  AX_Hdr, Aux_Therm, A3_PS, A4_PS, A5_PS,
 /* seq c */  Credits,      /* was reboot with memory reset */
 /* store */    /* jump to pneu diagnostics   */
 /* seq   */  Cksum,
 /* c tbl */  BI_Hdr, BI_Therm, BI_PS_Terms, BI_FS_Parms, BI_SPR,
 /* b inj */  BD_Hdr, BD_Therm, BD_PS_1, BD_PS_2, BD_PS_3, BD_Frit_1, BD_Frit_2, BD_Frit_3
 /* tray  */    /* reboot quick */
 /* ameth */    /* leave pneu_keys */
              } PNEU_KEY_DISPLAY_OBJECT;

#endif

/**end_proto**/


#if 0

/**begin_proto**/

extern const char * const Pneu_Messages[];
extern const U_INT16 Det_Ready_Msg_No[2][2][3][2];
extern const char * const Modules[];
extern const char * const Pneu_Inlet_Types[];
extern const char * const P_Sensor_Types[];
extern const char * const F_Sensor_Types[];
extern const char * const EEprom_Det_Types[];
extern const char * const EEprom_Aux_Types[];
extern const char * const Gas_Types[];
extern const char * const  On_Off_Labels[];
extern const char * const  My_Digits[];
extern const char * const  Pres_Names[];
extern const char * const  Ready_States[];
extern const char * const  Broken_Str[];

extern const char  OEMGas1PresLabel[9];
extern const char  OEMGas2PresLabel[9];
extern const char  OEMGas3PresLabel[9];
extern const char  OEMGas1FlowLabel[9];
extern const char  OEMGas2FlowLabel[9];
extern const char  OEMGas3FlowLabel[9];

extern const BIT8  OEMCtl1Label[13];
extern const BIT8  OEMCtl2Label[13];
extern const BIT8  OEMCtl3Label[13];
extern const BIT8  OEMCtl4Label[13];
extern const BIT8  OEMCtl5Label[13];

extern const char  OEMDataOutLabel[13];
extern const char  OEMDataInLabel[13];

extern const char  OEMDiag1Label[13];
extern const char  OEMDiag2Label[13];

extern BIT8    Super_Wizard;
extern PNEU_KEY_DISPLAY_OBJECT  Object;
extern U_INT8  Buffer_Number;
extern U_INT8  Which_Line_Active;
extern U_INT16 EEPROM_Write_Address;
extern U_INT16 EEPROM_Write_Data;
extern U_INT8  Module;
extern U_INT8  Gas;
extern U_INT8  Type;
extern U_INT16 Programming;
extern U_INT16 Range;
extern BIT8    Prog_Result;
extern U_INT16 Data;
extern U_INT16 test_station_id;
extern U_INT16 ser_no_low;
extern U_INT16 ser_no_high;
extern U_INT16 build_date;
extern U_INT8  Active_Error_Line;


extern BIT8    Stepping;
extern BIT8    Go;
extern BIT8    Pcb_Cmd_Sent;
extern BIT8    Use_Thermal_Setpt;
extern BIT8    Actual_Equals_Setpt;
extern U_INT8  Active_Buffer_Number;
extern U_INT16 PFEW;

extern EEPROM_WRITE_STRUCT Eeprom_Pfail_Mem [ 5 ];


/**end_proto**/


#endif



const char * const Pneu_Messages[] = {
 (char *) "                    \015",
 (char *) "Front Inlet:        \015",   /*  1 */
 (char *) "PS Range:           \015",   /*  2 */
 (char *) "Scaling:            \015",   /*  3 */
 (char *) "Back Inlet:         \015",   /*  4 */

 (char *) "Column1 C1          \015",   /*  5 */
 (char *) "Column1 C2          \015",   /*  6 */
 (char *) "Column1 C3          \015",   /*  7 */
 (char *) "IU                  \015",   /*  8 */

 (char *) "Column2 C1          \015",   /*  9 */
 (char *) "Column2 C2          \015",   /* 10 */
 (char *) "Column2 C3          \015",   /* 11 */
 (char *) "IU                  \015",   /* 12 */

 (char *) "Front Det           \015",   /* 13 */
 (char *) "Back Det            \015",   /* 14 */

 (char *) "Gas 1               \015",   /* 15 */
 (char *) "Gas 2               \015",   /* 16 */
 (char *) "Gas 3               \015",   /* 17 */

 (char *) "Aux 3               \015",   /* 18 */
 (char *) "Aux 4               \015",   /* 19 */
 (char *) "Aux 5               \015",   /* 20 */
 (char *) "  * poof *          \015",   /* 21 */

 (char *) "Gas                 \015",   /* 22 */
 (char *) "Aux                 \015",   /* 23 */

 (char *) "EPC                 \015",   /* 24 */
 (char *) "DirtBall            \015",   /* 25 */

 (char *) "F Det Gas 1         \015",   /* 26 */
 (char *) "F Det Gas 2         \015",   /* 27 */
 (char *) "F Det Gas 3         \015",   /* 28 */
 (char *) "Nice try.           \015",   /* 29 */


 (char *) "B Det Gas 1         \015",   /* 30 */
 (char *) "B Det Gas 2         \015",   /* 31 */
 (char *) "B Det Gas 3         \015",   /* 32 */
 (char *) "Only wizards allowed\015",   /* 33 */

 (char *) "Pneu Error          \015",   /* 34 */
 (char *) "Sig Dsp Unhappy     \015",   /* 35 */
 (char *) "Pneu Cksum          \015",   /* 36 */
 (char *) "SPI Fault           \015",   /* 37 */

 (char *) "Fake Heaters    OFF \015",   /* 38 */
 (char *) "Fake Heaters     ON \015",   /* 39 */

 (char *) "Sent  @             \015",   /* 40 */
 (char *) "Recvd @             \015",   /* 41 */

 (char *) "Pneu Cmd Step       \015",   /* 42 */
 (char *) "Paused On PCB Cmd   \015",   /* 43 */
 (char *) "Paused After Resp   \015",   /* 44 */

 (char *) "Are you a wizard?   \015",   /* 45 */
 (char *) "Prove it.           \015",   /* 46 */
 (char *) "No Method Errors    \015",   /* 47 */

 (char *) "Press Clear to Go   \015",   /* 48 */

 (char *) "331 Pneu Stopped    \015",   /* 49 */
 (char *) "331 Pneu Alive      \015",   /* 50 */

 (char *) "Done.               \015",    /* 51 */

 (char *) "Init EEPROM:        \015",    /* 52 */
 (char *) "Type                \015",    /* 53 */
 (char *) "PSensor Range       \015",    /* 54 */
 (char *) "press 1 to erase    \015",    /* 55 */
 (char *) "Addr:     Data:     \015",    /* 56 */

 (char *) "Actual=Setpt        \015",    /* 57 */

 (char *) "Failed!             \015",    /* 58 */

 (char *) "Restarted:          \015",    /* 59 */
 (char *) "Shutdown:           \015",    /* 60 */
 (char *) "Poweron Result:     \015",    /* 61 */
 (char *) "Last PCB Error:     \015",    /* 62 */

 (char *) "Ctrl Avg         mS \015",    /* 63 */
 (char *) "Ctrl Peak        mS \015",    /* 64 */
 (char *) "Disp Avg         mS \015",    /* 65 */
 (char *) "Disp Peak        mS \015",    /* 66 */


 (char *) "Atm Pres       psia \015",    /* 67 */
 (char *) "       V       \" Hg \015",   /* 68 */

 (char *) "Pres                \015",    /* 69 */
 (char *) "TCorr               \015",    /* 70 */
 (char *) "PCorr               \015",    /* 71 */
 (char *) "FD G1               \015",    /* 72 */
 (char *) "FD G2               \015",    /* 73 */
 (char *) "FD G3               \015",    /* 74 */

 (char *) "BD G1               \015",    /* 75 */
 (char *) "BD G2               \015",    /* 76 */
 (char *) "BD G3               \015",    /* 77 */

 (char *) "FInlet              \015",    /* 78 */
 (char *) "BInlet              \015",    /* 79 */
 (char *) "FDet                \015",    /* 80 */
 (char *) "BDet                \015",    /* 81 */

 (char *) "Temp Comp           \015",    /* 82 */
 (char *) "Env Update Tics     \015",    /* 83 */

 (char *) "Flow                \015",    /* 84 */
 (char *) "Volts               \015",    /* 85 */
 (char *) "dV                  \015",    /* 86 */
 (char *) "Adc                 \015",    /* 87 */

 (char *) "Pres                \015",    /* 88 */
 (char *) "Volts               \015",    /* 89 */
 (char *) "dV                  \015",    /* 90 */
 (char *) "Adc                 \015",    /* 91 */

 (char *) "Col1 Atm P Comp     \015",    /* 92 */
 (char *) "Col2 Atm P Comp     \015",    /* 93 */

 (char *) "F Inlet T Comp      \015",    /* 94 */
 (char *) "B Inlet T Comp      \015",    /* 95 */

 (char *) "F Det T Comp        \015",    /* 96 */
 (char *) "B Det T Comp        \015",    /* 97 */

 (char *) "Setpt   Real    NTP \015",    /* 98 */
 (char *) "Actual  Real    NTP \015",    /* 99 */
 (char *) "Pres                \015",    /* 100 */
 (char *) "Flow                \015",    /* 101 */
 (char *) "Uavg                \015",    /* 102 */

 (char *) "Sig Retry           \015",    /* 103 */
 (char *) "Rtry Fail           \015",    /* 104 */
 (char *) "Analog Lost         \015",    /* 105 */

 (char *) "Read Cksum          \015",    /* 106 */
 (char *) "Writ Cksum          \015",    /* 107 */
 (char *) "Overrun             \015",    /* 108 */

 (char *) "+10V                \015",    /* 109 */
 (char *) "Offset              \015",    /* 110 */
 (char *) "FI Gas              \015",    /* 111 */
 (char *) "BI Gas              \015",    /* 112 */

 (char *) "               Peak \015",    /* 113 */
 (char *) "                to  \015",    /* 114 */
 (char *) "               Peak \015",    /* 115 */

 (char *) "               Filt \015",    /* 116 */
 (char *) "               Avg  \015",    /* 117 */

 (char *) "A3 P                \015",    /* 118 */
 (char *) "A4 P                \015",    /* 119 */
 (char *) "A5 P                \015",    /* 120 */

 (char *) "Solvent saver       \015",    /* 121 */
 (char *) "Counts Left         \015",    /* 122 */
 (char *) "Interval (Sec)      \015",    /* 123 */

 (char *) "               Avg  \015",    /* 124 */

 (char *) "This will erase all \015",    /* 125 */
 (char *) "calibration of this \015",    /* 126 */
 (char *) "module. DELETE to   \015",    /* 127 */
 (char *) "continue, 0 to exit \015",    /* 128 */

 (char *) "Det Dsp Status      \015",    /* 129 */

 (char *) "          Temps Atmp\015",    /* 130 */
 (char *) "          10V Offset\015",    /* 131 */
 (char *) "          Gas Drive \015",    /* 132 */

 (char *) "               ICAP \015",    /* 133 */
 (char *) "               Ctrs \015",    /* 134 */

 (char *) "Col                 \015",    /* 135 */
 (char *) "SPR                 \015",    /* 136 */
 (char *) "Spl                 \015",    /* 137 */
 (char *) "Tot                 \015",    /* 138 */

 (char *) "FI Pres       Ready \015",    /* 139 */
 (char *) "FI Pres   Not Ready \015",    /* 140 */

 (char *) "BI Pres       Ready \015",    /* 141 */
 (char *) "BI Pres   Not Ready \015",    /* 142 */

 (char *) "FI Flow       Ready \015",    /* 143 */
 (char *) "FI Flow   Not Ready \015",    /* 144 */

 (char *) "BI Flow       Ready \015",    /* 145 */
 (char *) "BI Flow   Not Ready \015",    /* 146 */

 (char *) "Fake Oven        ON \015",    /* 147 */
 (char *) "Fake Oven       OFF \015",    /* 148 */

 (char *) "Recalib:            \015",    /* 149 */
 (char *) "Gas                 \015",     /* 150 */

 (char *) "a                   \015",     /* 151 */
 (char *) "b                   \015",     /* 152 */
 (char *) "Vo                  \015",     /* 153 */
 (char *) "Fsw                 \015",     /* 154 */

 (char *) "Halt on Err         \015",     /* 155 */
 (char *) "Halt on Shut        \015",     /* 156 */
 (char *) "Halt on Cksum       \015",     /* 157 */

 (char *) "Module              \015",     /* 158 */
 (char *) "Calced Cksum        \015",     /* 159 */
 (char *) "Stored Cksum        \015",     /* 160 */
 (char *) "Press 1:calc 9:write\015",     /* 161 */

 (char *) "    Real wizards    \015",     /* 162 */
 (char *) "  don't need help.  \015",     /* 163 */

 (char *) " Abandon hope all   \015",     /* 164 */
 (char *) " ye who enter here  \015",     /* 165 */
 (char *) "                    \015",     /* 166 */

 (char *) "Aux3 Pres     Ready \015",     /* 167 */
 (char *) "Aux3 Pres Not Ready \015",     /* 168 */
 (char *) "Aux4 Pres     Ready \015",     /* 169 */
 (char *) "Aux4 Pres Not Ready \015",     /* 170 */
 (char *) "Aux5 Pres     Ready \015",     /* 171 */
 (char *) "Aux5 Pres Not Ready \015",     /* 172 */

 (char *) "Channel in shutdown \015",     /* 173 */

 (char *) "FD Fuel P     Ready \015",     /* 174 */
 (char *) "FD Fuel P Not Ready \015",     /* 175 */
 (char *) "FD Util P     Ready \015",     /* 176 */
 (char *) "FD Util P Not Ready \015",     /* 177 */
 (char *) "FD Mug  P     Ready \015",     /* 178 */
 (char *) "FD Mug  P Not Ready \015",     /* 179 */
 (char *) "FD Fuel F     Ready \015",     /* 180 */
 (char *) "FD Fuel F Not Ready \015",     /* 181 */
 (char *) "FD Util F     Ready \015",     /* 182 */
 (char *) "FD Util F Not Ready \015",     /* 183 */
 (char *) "FD Mug  F     Ready \015",     /* 184 */
 (char *) "FD Mug  F Not Ready \015",     /* 185 */

 (char *) "BD Fuel P     Ready \015",     /* 186 */
 (char *) "BD Fuel P Not Ready \015",     /* 187 */
 (char *) "BD Util P     Ready \015",     /* 188 */
 (char *) "BD Util P Not Ready \015",     /* 189 */
 (char *) "BD Mug  P     Ready \015",     /* 190 */
 (char *) "BD Mug  P Not Ready \015",     /* 191 */
 (char *) "BD Fuel F     Ready \015",     /* 192 */
 (char *) "BD Fuel F Not Ready \015",     /* 193 */
 (char *) "BD Util F     Ready \015",     /* 194 */
 (char *) "BD Util F Not Ready \015",     /* 195 */
 (char *) "BD Mug  F     Ready \015",     /* 196 */
 (char *) "BD Mug  F Not Ready \015",     /* 197 */

 (char *) "Therm Span          \015",     /* 198 */
 (char *) "Method Error        \015",     /* 199 */
 (char *) "Item                \015",     /* 200 */
 (char *) "Config              \015",     /* 201 */
 (char *) "Method              \015",     /* 202 */

 (char *) "V 25C               \015",     /* 203 */
 (char *) "DeltaV              \015",     /* 204 */
 (char *) "DeltaT              \015",     /* 205 */

 (char *) "Offset              \015",     /* 206 */
 (char *) "Offset              \015",     /* 207 */
 (char *) "F1 Off              \015",     /* 208 */
 (char *) "F2 Off              \015",     /* 209 */
 (char *) "F3 Off              \015",     /* 210 */
 (char *) "B1 Off              \015",     /* 211 */
 (char *) "B2 Off              \015",     /* 212 */
 (char *) "B3 Off              \015",     /* 213 */
 (char *) "A3 Off              \015",     /* 214 */
 (char *) "A4 Off              \015",     /* 215 */
 (char *) "A5 Off              \015",     /* 216 */

 (char *) "Span                \015",     /* 217 */
 (char *) "dO/dT               \015",     /* 218 */
 (char *) "dS/dT               \015",     /* 219 */


 (char *) "FD Fuel             \015",     /* 220 */
 (char *) "FD Util             \015",     /* 221 */
 (char *) "FD MUG              \015",     /* 222 */
 (char *) "FD Fuel             \015",     /* 223 */
 (char *) "BD Util             \015",     /* 224 */
 (char *) "BD MUG              \015",     /* 225 */

 (char *) "Alpha               \015",     /* 226 */
 (char *) "Beta                \015",     /* 227 */
 (char *) "Scaling             \015",     /* 228 */

 (char *) "Frnt Inlet          \015",     /* 229 */
 (char *) "Back Inlet          \015",     /* 230 */
 (char *) "Frnt Det            \015",     /* 231 */
 (char *) "Back Det            \015",     /* 232 */
 (char *) "Pneu Aux            \015",     /* 233 */

 (char *) "Ser No.             \015",     /* 234 */
 (char *) "Built(dmy)   /  /   \015",     /* 235 */
 (char *) "Test Station        \015",     /* 236 */

 (char *) "Max Flow            \015",     /* 237 */
 (char *) "dF/dP               \015",     /* 238 */
 (char *) "Septum Purge Reg    \015",     /* 239 */

 (char *) "Erasing Front Inlet \015",     /* 240 */
 (char *) "Erasing Back Inlet  \015",     /* 241 */
 (char *) "Erasing Front Det   \015",     /* 242 */
 (char *) "Erasing Back Det    \015",     /* 243 */
 (char *) "Erasing Pneu Aux    \015",     /* 244 */

 (char *) "Error:  you can not \015",     /* 245 */
 (char *) " erase a calibrated \015",     /* 246 */
 (char *) "   module without   \015",     /* 247 */
 (char *) "     permission.    \015",     /* 248 */
 (char *) "AutoCal Delay       \015",     /* 249 */

 (char *) "All calibration info\015",     /* 250 */
 (char *) "has been lost.      \015",     /* 251 */

 (char *) "Credit the firmware \015",     /* 252 */
 (char *) "group, people who   \015",     /* 253 */
 (char *) "got stuck with it!  \015",     /* 254 */
 (char *) "stuck with it.      \015",     /* 255 */
 (char *) "Bob Cook            \015",     /* 256 */
 (char *) "Bryan Bente         \015",     /* 257 */
 (char *) "John DeGood         \015",     /* 258 */
 (char *) "Lesley Freed        \015",     /* 259 */
 (char *) "Rick Wikfors        \015",     /* 260 */
 (char *) "Tom Przybylski      \015",     /* 261 */

 (char *) "Calib Offset   Gain \015",     /* 262 */
 (char *) "CH1      cnt       %\015",     /* 263 */
 (char *) "CH2      cnt       %\015",     /* 264 */
 (char *) "CH3      cnt       %\015",     /* 265 */
 (char *) "Last AutoCal        \015",     /* 266 */

 (char *) "Executing           \015",     /* 267 */
 (char *) "Halted              \015",     /* 268 */
 (char *) "Set Error:          \015",     /* 269 */
 (char *) "Done                \015",     /* 270 */
 (char *) "Test         Step   \015",     /* 271 */
 (char *) "Bounds              \015",     /* 272 */

 (char *) "a         c         \015",     /* 273 */
 (char *) "b         d         \015",     /* 274 */
 (char *) "t         error     \015",     /* 275 */
 (char *) "Test code missing.  \015",     /* 276 */

 (char *) "I off @             \015",     /* 277 */
 (char *) "Int level           \015",     /* 278 */

 (char *) "F1 P                \015",     /* 279 */
 (char *) "F2 P                \015",     /* 280 */
 (char *) "F3 P                \015",     /* 281 */

 (char *) "B1 P                \015",     /* 282 */
 (char *) "B2 P                \015",     /* 283 */
 (char *) "B3 P                \015",     /* 284 */

 (char *) "                    \015"      /* end */
};

const U_INT16 Det_Ready_Msg_No[2][2][3][2] = { {{{ 174, 175 }, { 176, 177 }, { 178, 179 }},   /* fd P */
                                                {{ 186, 187 }, { 188, 189 }, { 190, 191 }} }, /* bd P */
                                               {{{ 180, 181 }, { 182, 183 }, { 184, 185 }},   /* fd F */
                                                {{ 192, 193 }, { 194, 195 }, { 196, 197 }}}}; /* bd F */

const char * const Modules[] = { "F Inlet", "B Inlet", "F Det", "B Det", "Aux" };

const char * const Pneu_Inlet_Types[] = { "pp", "coc", "ss", "ptv", "man pp",
                                          "man coc", "man ss", "Unkwn", "None", "aci", "gptv","man aci","hp-ptv",
                                          "simdist", "cis3", "Jill", "vi" };           /* 7 chars max */

const char * const P_Sensor_Types[] = { "100", "15", "150" };

const char * const F_Sensor_Types[] = { "200", "700", "None" };

const char * const EEprom_Det_Types[] = { "EPC FID", "EPC TCD", "EPC NPD", "EPC ECD", "EPC FPD",
                                          "Man FID", "Man TCD", "Man NPD", "Man ECD", "Man FPD",
                                          "Nu uECD", "uM uECD", "EPC LDID"  };

const char * const EEprom_Aux_Types[] = { "3 Pres", "3 Flow" };

const char * const Gas_Types[] = { "N2", "H2", "He", "ArMe", "O2", "Air", "Ar", "??" };

const char * const  On_Off_Labels[] = { "OFF", "ON" };

const char * const  My_Digits[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };

const char * const  Pres_Names[] = { "Stormy", "Rainy", "Changeable", "Fair", "Very Dry" };

const char * const  Ready_States[] = { "Not In Control",  "Ready Delay (Equib)", "Forced Not Ready",   "In Control",
                                       "Not Ready Delay", "Waiting to Ignore",   "Ignoring Not Ready", "(Off)" };

const char * const  Broken_Str[] = { "Broken" };

const char  OEMGas1PresLabel[9] = { "Gas1Pres\000" };
const char  OEMGas2PresLabel[9] = { "Gas2Pres\000" };
const char  OEMGas3PresLabel[9] = { "Gas3Pres\000" };


const char  OEMGas1FlowLabel[9] = { "Gas1Flow\000" };
const char  OEMGas2FlowLabel[9] = { "Gas2Flow\000" };
const char  OEMGas3FlowLabel[9] = { "Gas3Flow\000" };

const BIT8  OEMCtl1Label[13]    = { "Control 1   \000" };
const BIT8  OEMCtl2Label[13]    = { "Control 2   \000" };
const BIT8  OEMCtl3Label[13]    = { "Control 3   \000" };
const BIT8  OEMCtl4Label[13]    = { "Control 4   \000" };
const BIT8  OEMCtl5Label[13]    = { "Control 5   \000" };

const char  OEMDataOutLabel[13] = { "Setpoint    \000" }; /* "DetData" to test common line */
const char  OEMDataInLabel[13]  = { "Actual      \000" }; /* "DetData" to test common line */

const char  OEMDiag1Label[13]  = { "Diagnostic 1\000" };
const char  OEMDiag2Label[13]  = { "Diagnostic 2\000" };


/*****************************/
/*   STATIC VARIABLES        */
/*****************************/

BIT8    Super_Wizard;
PNEU_KEY_DISPLAY_OBJECT  Object;
U_INT8  Buffer_Number;
U_INT8  Which_Line_Active;
U_INT16 EEPROM_Write_Address;
U_INT16 EEPROM_Write_Data;
U_INT8  Module;
U_INT8  Gas;
U_INT8  Type;
U_INT16 Programming;
U_INT16 Range;
BIT8    Prog_Result;
U_INT16 Data;
U_INT16 test_station_id;
U_INT16 ser_no_low;
U_INT16 ser_no_high;
U_INT16 build_date;
U_INT16 Environment_Tics;
U_INT8  Active_Error_Line;


#pragma SECTION UDATA=pfail

BIT8    Stepping;
BIT8    Go;
BIT8    Pcb_Cmd_Sent;
BIT8    Use_Thermal_Setpt;
BIT8    Actual_Equals_Setpt;
U_INT8  Active_Buffer_Number;
U_INT16 PFEW;

EEPROM_WRITE_STRUCT Eeprom_Pfail_Mem [ 5 ];

#pragma SECTION UNDO


#pragma SECTION UDATA=tcomp

INLET_TCOMP_STRUCT     Frnt_Inlet_Tcomp_Tables;
INLET_TCOMP_STRUCT     Back_Inlet_Tcomp_Tables;
DETECTOR_TCOMP_STRUCT  Frnt_Det_Tcomp_Tables;
DETECTOR_TCOMP_STRUCT  Back_Det_Tcomp_Tables;
AUX_TCOMP_STRUCT       Pneu_Aux_Tcomp_Tables;

#pragma SECTION UNDO

/**begin_proto**/
extern volatile INT32 COOKIE;
/**end_proto**/
volatile INT32 COOKIE;


/**begin_proto**/

extern const RAMP_TYPE NativeRampType[2][15][4];

/**end_proto**/

/* Note : entries in this matrix declare how the users DESIRED mode is really EXECUTED in the f/w  .
          For example, if used selects "undefined, COC, Const_F", then 6890 really exceutes a
          pressure ramp with slope=0 .  ( Note that ramp generators always run; Const X just gets
          slope = 0 )
*/

const RAMP_TYPE NativeRampType    [ 2 /* column defined */ ]
                                  [15 /* source type    */ ]
                                  [ 4 /* control mode   */ ] = {
{ /* un defined */            /*         Const P          Const F           Ramp P          Ramp F        */
             /* PP_INLET      */  {  INVALID_RAMP,       FLOW_RAMP,     INVALID_RAMP,    FLOW_RAMP    },
             /* COC_INLET     */  { PRESSURE_RAMP,   PRESSURE_RAMP,    PRESSURE_RAMP, INVALID_RAMP    },
             /* SS_INLET      */  { PRESSURE_RAMP,   PRESSURE_RAMP,    PRESSURE_RAMP, INVALID_RAMP    },
             /* PTV_INLET     */  { PRESSURE_RAMP,   PRESSURE_RAMP,    PRESSURE_RAMP, INVALID_RAMP    },
             /* MAN_PP_INLET  */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* MAN_COC_INLET */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* MAN_SS_INLET  */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* SOME_AUX      */  { PRESSURE_RAMP,   PRESSURE_RAMP,    PRESSURE_RAMP, INVALID_RAMP    },
             /* UNKNOWN_TYPE  */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* ACI_INLET     */  {  INVALID_RAMP,       FLOW_RAMP,     INVALID_RAMP,    FLOW_RAMP    },
             /* G_PTV_INLET   */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* MAN_ACI_INLET */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* HP-PTV(cis4)  */  { PRESSURE_RAMP,   PRESSURE_RAMP,    PRESSURE_RAMP, INVALID_RAMP    },
             /* SIMDIST_INLET */  {  INVALID_RAMP,       FLOW_RAMP,     INVALID_RAMP,    FLOW_RAMP    },
             /* CIS3_INLET    */  { PRESSURE_RAMP,   PRESSURE_RAMP,    PRESSURE_RAMP, INVALID_RAMP    } },
             /* VOLATILES_capped                       same as PP_INLET w/ undefined column           */
             /* VOLATILES_plumbed                      same as SS_INLET w/ undefined column           */
{ /* defined */
             /* PP_INLET      */  {  PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,    FLOW_RAMP    },
             /* COC_INLET     */  {  PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,    FLOW_RAMP    },
             /* SS_INLET      */  {  PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,    FLOW_RAMP    },
             /* PTV_INLET     */  {   INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* MAN_PP_INLET  */  {   INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* MAN_COC_INLET */  {   INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* MAN_SS_INLET  */  {   INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* SOME_AUX      */  {  PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,    FLOW_RAMP    },
             /* UNKNOWN_TYPE  */  {   INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* ACI_INLET     */  {  PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,    FLOW_RAMP    },
             /* G_PTV_INLET   */  {  INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP     },
             /* MAN_ACI_INLET */  {   INVALID_RAMP,    INVALID_RAMP,     INVALID_RAMP, INVALID_RAMP    },
             /* HP-PTV(cis4)  */  { PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,     FLOW_RAMP    },
             /* SIMDIST_INLET */  {  PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,    FLOW_RAMP    },
             /* CIS3_INLET    */  { PRESSURE_RAMP,       FLOW_RAMP,    PRESSURE_RAMP,     FLOW_RAMP    } } };
             /* VOLATILES_capped                       same as PP_INLET w/   defined column           */
             /* VOLATILES_plumbed                      same as SS_INLET w/   defined column           */

/**begin_proto**/
extern const U_INT8 Inlet_Channel_Map[2][2];
extern const U_INT8 Det_Channel_Map[2][3];
extern const U_INT8 Aux_Channel_Map[3];
/**end_proto**/

const U_INT8 Inlet_Channel_Map[2][2] = {
  { FRNT_INLET_PRESSURE_INDEX - FIRST_CHANNEL_INDEX,
    FRNT_INLET_FLOW_INDEX     - FIRST_CHANNEL_INDEX },
  { BACK_INLET_PRESSURE_INDEX - FIRST_CHANNEL_INDEX,
    BACK_INLET_FLOW_INDEX     - FIRST_CHANNEL_INDEX } };

const U_INT8 Det_Channel_Map[2][3] = {
  { FRNT_DETECTOR_GAS_1_INDEX - FIRST_CHANNEL_INDEX,
    FRNT_DETECTOR_GAS_2_INDEX - FIRST_CHANNEL_INDEX,
    FRNT_DETECTOR_GAS_3_INDEX - FIRST_CHANNEL_INDEX },
  { BACK_DETECTOR_GAS_1_INDEX - FIRST_CHANNEL_INDEX,
    BACK_DETECTOR_GAS_2_INDEX - FIRST_CHANNEL_INDEX,
    BACK_DETECTOR_GAS_3_INDEX - FIRST_CHANNEL_INDEX } };

const U_INT8 Aux_Channel_Map[3] = {
    AUX_3_INDEX - FIRST_CHANNEL_INDEX,
    AUX_4_INDEX - FIRST_CHANNEL_INDEX,
    AUX_5_INDEX - FIRST_CHANNEL_INDEX };


/**begin_proto**/

#define MAX_LOAD_ERRORS  60

typedef struct { U_INT32 item;
                 U_INT32 current;
                 U_INT32 method;

               } METH_ERROR_ENTRY;

#pragma SECTION DATA=tcomp

extern METH_ERROR_ENTRY meth_error_list [ MAX_LOAD_ERRORS ];

extern U_INT8 meth_check_errors;

#pragma SECTION UNDO

/**end_proto**/


#pragma SECTION DATA=tcomp

METH_ERROR_ENTRY meth_error_list [ MAX_LOAD_ERRORS ];

U_INT8 meth_check_errors;

#pragma SECTION UNDO



/*****************************/
/*   EXTERNAL VARIABLES      */
/*****************************/


/*****************************/
/*   LOCAL DEFINES           */
/*****************************/


/*****************************/
/*   IMPLEMENT SECTION       */
/*****************************/
